package com.hongyue.dey08;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) throws IOException {
        ArrayList<Student> arr = new ArrayList<>();
        arr.add(new Student("001", "张三", "21", "男"));
        arr.add(new Student("002", "李四", "23", "男"));
        arr.add(new Student("003", "王五", "20", "男"));
        arr.add(new Student("004", "赵六", "22", "女"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("dey11/src/com/hongyue/dey08/aaa.txt"));
        for (Student student : arr) {
            String s = student.getSid() + "," + student.getName() + "," + student.getAge() + "," + student.getGender();
            bw.write(s);
            bw.newLine();
            bw.flush();
        }
        bw.close();
    }
}
